using System;
using System.Collections.Generic;
using System.Text;

using PickGold;
using PickGold.Database;
using DataCommon = PickGold.Database.Common;

namespace PickGold.Entities.Table
{
    public class CBaseRoleInfo : CBaseTable
    {
        //
        public const string ENTITY_NAME = "tb_sys_role_info";
        public const string ENTITY_ALIAS = "roles";
		public const string ENTITY_KEY = DataCommon.ROLE_ID;
		public const string ENTITY_SYMBOL = DataCommon.ROLE_NAME;
        //
		public const string USER_ID = DataCommon.USER_ID;
		public const string ITEM_NOTE = DataCommon.ITEM_NOTE;
		public const string GRANT_ID = DataCommon.GRANT_ID;
		public const string ITEM_GRANT = DataCommon.ITEM_GRANT;
        //
        private SBaseRoleInfo _ = null;
        //
        public CBaseRoleInfo() : base(ENTITY_NAME, ENTITY_ALIAS) { }
        public CBaseRoleInfo(CDatabase db) : base(db, ENTITY_NAME, ENTITY_ALIAS) { }
        public CBaseRoleInfo(string alias) : base(ENTITY_NAME, alias) { }
        public CBaseRoleInfo(CDatabase db, string alias) : base(db, ENTITY_NAME, alias) { }
        //
        protected override void SetSchema()
        {
            this.SetSchema(new SBaseRoleInfo());
        }
        protected void SetSchema(SBaseRoleInfo s)
        {
            this._ = s;
            base.SetSchema(s);
        }
        //
        protected override void PreInitSchema()
        {
            base.PreInitSchema();
            this._DataTable.Columns.Add(USER_ID, typeof(long)).DefaultValue = this._.UserID;
            this._DataTable.Columns.Add(ITEM_NOTE, typeof(string)).MaxLength = 1024;
            this._DataTable.Columns.Add(GRANT_ID, typeof(long)).DefaultValue = this._.GrantID;
            this._DataTable.Columns.Add(ITEM_GRANT, typeof(long)).DefaultValue = this._.ItemGrant;
        }
        //
        #region Property
        //
        public long UserID
        {
            set
            {
                this._.UserID = value;
                this.SetValue(USER_ID, value);
            }
            get
            {
                return this._.UserID;
            }
        }
        //
        public string ItemNote
        {
            set
            {
                this._.ItemNote = value;
                this.SetValue(ITEM_NOTE, value);
            }
            get
            {
                return this._.ItemNote;
            }
        }
        //
		public long GrantID
        {
            set
            {
                this._.GrantID = value;
                this.SetValue(GRANT_ID, value);
            }
            get
            {
				return this._.GrantID;
            }
        }
        //
        public long ItemGrant
        {
            set
            {
                this._.ItemGrant = value;
                this.SetValue(ITEM_GRANT, value);
            }
            get
            {
                return this._.ItemGrant;
            }
        }
        //
        #endregion
        //
        public override bool MoveTo(int position)
        {
            if (!base.MoveTo(position))
                return false;
            this._.UserID = this.GetValue<long>(USER_ID);
            this._.ItemNote = this.GetValue<string>(ITEM_NOTE);
            this._.GrantID = this.GetValue<long>(GRANT_ID);
            this._.ItemGrant = this.GetValue<long>(ITEM_GRANT);
            return true;
        }
        //
    }
    //
    public class SBaseRoleInfo : SBaseTable
    {
        //
        public long UserID = -1;
        public string ItemNote = null;
        public long GrantID = -1;
        public long ItemGrant = 0;
        //
    }
    //
}
//
